1. Field of the Invention
This invention relates to a portable electronic device such as an IC card or IC tag contained in an IC chip in which individual information or transaction information is stored, for example, and a control method of the portable electronic device.
2. Description of the Related Art
Conventionally, contact and non-contact IC cards have serial interfaces of a half-duplex communication system as external communication interfaces. Some of the above IC cards have a function called as a logical channel. In the IC card having the function of the logical channel, a physically single interface can be simulatively used as plural communication interfaces by means of plural channels (logical channels). For example, an application A of an external device can be used to specify a channel 1 and an application B thereof can be used to specify a channel 2. In this case, the external device can communicate with an IC card in a time-sharing fashion by use of the applications A and B. That is, the applications A and B can be operated as if they communicate with the IC card in one-to-one correspondence. In the IC card having the logical channel function as described above, folders or files to be accessed can be managed and controlled independently for each specified channel.
In instructions (commands) supplied from the external device to the IC card, for example, a plurality of instructions such as a random number generation instruction and external authentication instruction that are required to be executed in a preset order are contained. This is to prevent occurrence of dishonest access. The above instructions are not correctly executed if the preset execution order is not maintained.
However, in the conventional IC cards, the instruction execution order is not managed for each logical channel. Therefore, when instructions are received from the external device via plural channels, the order of received instructions may not be set to the preset order in the conventional IC card even if the order of instruction groups received via the respective channels is correct. For example, it is assumed that instructions X and Y are instructions to be successively executed. In this case, if an instruction Z is received via the channel 2 immediately after the instruction X is received via the channel 1, the conventional IC card determines that the instructions should be executed in the order of X, Z. As a result, in the conventional IC card, there occurs a problem that the instructions X, Y cannot be correctly executed even if the instructions X, Y received via the channel 1 are set in the preset order.